{include file="public/head"}
{include file="public/left"}
<!-- content -->
<div class="main_02_r">

    <!--内容区域-->
    <div class="site_01">
        <span>当前位置：</span><a href="#">城事社</a><i>&gt;</i><a href="#">广告管理</a><i>&gt;</i><a href="#">广告列表</a>
    </div>

    <div class="nrq_01">
        <div class="gg_01">
            <span class="on">广告列表</span><span  class=""><a href="{:url('advertising/booth')}">展位列表</a></span>
        </div>
        <div class="gg_02">
            <div class="gg_03">

                <div class="gg_03_t">
                    <em class="fr">
                        <form method="get">
                        <input type="text" value="{$search|default=''}" placeholder="请输入有关广告的关键词" class="gg_03_txt"><input type="button" value="" class="gg_03_btn">
                        </form>
                    </em>
                </div>

                <div class="jgsp_01">
                    <table cellpadding="0" cellspacing="0">
                        <tbody>
                        <tr>
                            <th>序号</th>
                            <th>位置选择</th>
                            <th>编号</th>
                            <th>时限</th>
                            <th>费用</th>
                            <th>起始时间</th>
                            <th>结束时间</th>
                            <th>剩余时间</th>
                            <th>广告图片</th>
                            <th>广告内容</th>
                            <th>投放者</th>
                            <th>操作</th>
                        </tr>
                        {volist name="arr" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.space_name}</td>
                            <td>{$vo.serial_number}</td>
                            <td>{$vo.time_unit}</td>
                            <td>{$vo.money}</td>
                            <td>{$vo.begin_time}</td>
                            <td>{$vo.end_time}</td>
                            <td><?php echo (floor($vo['time_difference']/86400)); ?>天<?php echo (floor($vo['time_difference']%86400/3600)); ?>小时<?php echo (floor($vo['time_difference']%86400%3600/60)); ?>分</td>
                            <td><img src="{$vo.pic_url}" class="img_gg"></td>
                            <td><a href="#" class="a_link"></a></td>
                            <td>{$vo.nick_name}</td>
                            <td>
                                <a href="#" class="a_cz jgsp_click">编辑</a>
                                <a href="javascript:ajax_delete('{$vo.id}')" class="a_cz">删除</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>

                <div class="gg_03_b">
                    <div class="fl">
                        <span>共 <i>{$arr->total()}</i> 条</span><span>每页 <i>{$arr->listRows()}</i> 条</span>
                    </div>
                    <div class="fr">
                        {$arr->render()}
                    </div>
                </div>

            </div>
        </div>

    </div>

</div>
<script type="text/javascript">
    var layer = layui.layer,form = layui.form;
    function ajax_delete(id) {
        $.ajax({
            url: "{:url('advertising/ajax_delete')}",
            type: "POST",//方法类型
            // dataType: "json",//预期服务器返回的数据类型
            data: {"id":id},
            success: function (data) {
                if (data.code === 1) {
                    layer.msg("<span style='margin-left: 18px;'>" + data.msg + "</span>", {
                        icon: 1,
                        time: 1000
                    }, function () {
                        window.location.href = data.url;
                    });
                } else {
                    layer.msg("<span style='margin-left: 18px;'>" + data.msg + "</span>", {
                        icon: 2,
                        time: 1000
                    }, function () {
                        /*if(data.url){
                        window.location.href=data.url;
                    }else{
                        location.reload();
                    }*/
                    });
                }
            },
            error: function () {
                layer.msg("<span style='margin-left: 18px;'>请求错误,请联系管理员</span>", {
                    icon: 0,
                    time: 1000
                }, function () {
                    //location.reload();
                });
            }
        });
    }
</script>
<!-- content -->
{include file="public/foot"}